/*
 * Created by JFormDesigner on Wed Jun 26 14:24:39 CST 2024
 */

package scct.zhang.ui;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * @author 张
 */
public class FromMain extends JFrame {
    public FromMain() {
        initComponents();
    }

    private void btnUser(ActionEvent e) {
        System.out.println("btnuser");
        // 创建面板
        PanelUserManger panelUserManger = new PanelUserManger(this);
//        先把已经加载的其他管理面板移出
        panelMain.removeAll();
//        加载用户管理面板
        panelMain.add(panelUserManger,BorderLayout.CENTER);
//        刷新页面
        validate();
        
        
    }

    private void btnType(ActionEvent e) {
        // TODO add your code here
        PanelType panelType = new PanelType(this);
        panelMain.removeAll();
        panelMain.add(panelType,BorderLayout.CENTER);
        validate();

    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        // Generated using JFormDesigner Evaluation license - zhang
        menuBar1 = new JMenuBar();
        menu1 = new JMenu();
        mnuUser = new JMenuItem();
        mnuExit = new JMenuItem();
        mnuBrand = new JMenu();
        menuItem3 = new JMenuItem();
        mnuType = new JMenuItem();
        mnuGoods = new JMenuItem();
        munSell = new JMenuItem();
        menu3 = new JMenu();
        mnuAbout = new JMenuItem();
        toolBar1 = new JToolBar();
        btnUser = new JButton();
        btnType = new JButton();
        button3 = new JButton();
        button4 = new JButton();
        panelMain = new JPanel();

        //======== this ========
        setTitle("\u5546\u5e97\u7ba1\u7406\u7cfb\u7edf");
        var contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());

        //======== menuBar1 ========
        {

            //======== menu1 ========
            {
                menu1.setText("\u7cfb\u7edf");

                //---- mnuUser ----
                mnuUser.setText("\u7528\u6237\u7ba1\u7406");
                menu1.add(mnuUser);

                //---- mnuExit ----
                mnuExit.setText("\u9000\u51fa");
                menu1.add(mnuExit);
            }
            menuBar1.add(menu1);

            //======== mnuBrand ========
            {
                mnuBrand.setText("\u7ba1\u7406");

                //---- menuItem3 ----
                menuItem3.setText("\u54c1\u724c\u7ba1\u7406");
                mnuBrand.add(menuItem3);

                //---- mnuType ----
                mnuType.setText("\u7c7b\u522b\u7ba1\u7406");
                mnuBrand.add(mnuType);

                //---- mnuGoods ----
                mnuGoods.setText("\u5546\u54c1\u7ba1\u7406");
                mnuBrand.add(mnuGoods);

                //---- munSell ----
                munSell.setText("\u9500\u552e\u7ba1\u7406");
                mnuBrand.add(munSell);
            }
            menuBar1.add(mnuBrand);

            //======== menu3 ========
            {
                menu3.setText("\u5173\u4e8e");

                //---- mnuAbout ----
                mnuAbout.setText("\u6211\u7684\u9879\u76ee");
                menu3.add(mnuAbout);
            }
            menuBar1.add(menu3);
        }
        setJMenuBar(menuBar1);

        //======== toolBar1 ========
        {

            //---- btnUser ----
            btnUser.setToolTipText("\u7528\u6237\u7ba1\u7406");
            btnUser.setIcon(new ImageIcon(getClass().getResource("/icon/yonghu.png")));
            btnUser.addActionListener(e -> btnUser(e));
            toolBar1.add(btnUser);

            //---- btnType ----
            btnType.setToolTipText("\u7c7b\u522b\u7ba1\u7406");
            btnType.setIcon(new ImageIcon(getClass().getResource("/icon/yonghu.png")));
            btnType.addActionListener(e -> btnType(e));
            toolBar1.add(btnType);

            //---- button3 ----
            button3.setToolTipText("\u54c1\u724c\u7ba1\u7406");
            button3.setIcon(new ImageIcon(getClass().getResource("/icon/yonghu.png")));
            toolBar1.add(button3);

            //---- button4 ----
            button4.setText("text");
            button4.setToolTipText("\u5546\u54c1\u7ba1\u7406");
            toolBar1.add(button4);
        }
        contentPane.add(toolBar1, BorderLayout.NORTH);

        //======== panelMain ========
        {
            panelMain.setBackground(Color.white);
            panelMain.setBorder (new javax. swing. border. CompoundBorder( new javax .swing .border .TitledBorder (new
            javax. swing. border. EmptyBorder( 0, 0, 0, 0) , "JF\u006frmD\u0065sig\u006eer \u0045val\u0075ati\u006fn", javax
            . swing. border. TitledBorder. CENTER, javax. swing. border. TitledBorder. BOTTOM, new java
            .awt .Font ("Dia\u006cog" ,java .awt .Font .BOLD ,12 ), java. awt
            . Color. red) ,panelMain. getBorder( )) ); panelMain. addPropertyChangeListener (new java. beans.
            PropertyChangeListener( ){ @Override public void propertyChange (java .beans .PropertyChangeEvent e) {if ("\u0062ord\u0065r" .
            equals (e .getPropertyName () )) throw new RuntimeException( ); }} );
            panelMain.setLayout(new BorderLayout());
        }
        contentPane.add(panelMain, BorderLayout.CENTER);
        setSize(400, 300);
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    // Generated using JFormDesigner Evaluation license - zhang
    private JMenuBar menuBar1;
    private JMenu menu1;
    private JMenuItem mnuUser;
    private JMenuItem mnuExit;
    private JMenu mnuBrand;
    private JMenuItem menuItem3;
    private JMenuItem mnuType;
    private JMenuItem mnuGoods;
    private JMenuItem munSell;
    private JMenu menu3;
    private JMenuItem mnuAbout;
    private JToolBar toolBar1;
    private JButton btnUser;
    private JButton btnType;
    private JButton button3;
    private JButton button4;
    private JPanel panelMain;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
